<extend name="Layout/ins_popup" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<select name="tag_list" id="tag_list" class="hidden">
		{:fill_option($tag_list)}
	</select>
	<div class="popup-frame">
		<div class="popup-header">
			<div class="pull-left">
				<h1>添加</h1>
			</div>
			<div class="pull-right">
				<a id="btn_save" class="btn" >确定</a>
				<a id="btn_close" class="btn btn-return">关闭</a>
			</div>
		</div>
		<div class="popup-body">
			<div class="popup-body-scroll">
				<div class="popup-content">
					<form id="form_data" name="form_data" method="post" >
						<input type="hidden" name="opmode" id="opmode" value="add">
						<input type="hidden" name="pid" id="pid" value="0">
						<input type="hidden" name="ajax" id="ajax" value="0">
						<input type="hidden" name="opmode" id="opmode" value="add">
						<input type="hidden" name="controller" id="controller" value="{$controller}">

						
							<label class="input-label" for="name">名称：</label>
							
								<input type="text" id="name" name="name" check="required" info="请输入名称" class="input">
							</div>
						</div>
						<if condition="$has_pid">
							
								<label class="input-label" for="tag_name">父节点*：</label>
								
									<div class="input-group">
										<input name="tag_name" class="input val" id="tag_name" type="text" info="请选择父节点" check="required" />
										<span class="input-group-btn">
											<button class="btn" id="btn_select_pid" type="button">
												选择
											</button> </span>
									</div>
								</div>
							</div>
						</if>
						
							<label class="input-label" for="sort">排序：</label>
							<div class="input-block col-10">
								<input type="text" id="sort" name="sort" class="input">
							</div>
						</div>
						
							<label class="input-label" for="is_del">状态：</label>
							<div class="input-block x-select col-10">
								<select   name="is_disable" id="is_disable" class="input col-10">
									<option value="">请选择</option>
									<option  value="0">启用</option>
									<option value="1">禁用</option>
								</select>
							</div>
						</div>
						
							<label class="input-label" for="remark">备注：</label>
							
								<textarea id="remark" name="remark" class="textarea"></textarea>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		layui.use(['global'], function() {
			var $ = layui.jquery;

			//保存后关闭
			$('#btn_save').on('click', function() {
				send_form('form_data', "{:url('SystemTag/save')}", '', function(ret) {
					if (ret.status == 1) {
						parent.layer.msg(ret.info);
						parent.layer.close(index);
						parent.location.reload(true);
					} else {
						parent.layer.msg(ret.info);
						return false;
					}
				});
			});

			//关闭iframe
			$('#btn_close').click(function() {
				parent.layer.close(index);
			});
		});
	</script>
</block>